<include file="public/layout" />
<body style="background-color: rgb(255, 255, 255); overflow: auto; cursor: default;">
<div class="page">
    <div class="fixed-bar">
        <div class="item-title">
            <div class="subject">
                <h3>维修分类管理</h3>
                <h5>维修分类添加与管理</h5>
            </div>
        </div>
    </div>
    <div id="explanation" class="explanation">
        <div id="checkZoom" class="title"><i class="fa fa-lightbulb-o"></i>
            <h4 title="提示相关设置操作时应注意的要点">操作提示</h4>
            <span title="收起提示" id="explanationZoom"></span>
        </div>
        <ul>
            <li>温馨提示：顶级分类（一级大类）</li>
            <!--<li>最多只能分类到三级</li>-->
            <!--<li style="color:#ff0000;"><strong>"是否推荐"->设置为推荐之后, 该分类会在首页楼层显示</strong></li>-->
        </ul>
    </div>
    <form method="post">
        <input type="hidden" value="ok" name="form_submit">
        <div class="flexigrid">
            <div class="mDiv">
                <div class="ftitle">
                    <h3>维修分类列表</h3>
                    <h5></h5>
                </div>
            </div>
            <div class="hDiv">
                <div class="hDivBox">
                    <table cellspacing="0" cellpadding="0">
                        <thead>
                        <tr>
                            <th align="center" axis="col0" class="sign">
                                <div style="text-align: center; width: 24px;"><i class="ico-check"></i></div>
                            </th>
                            <th align="center" axis="col2"><div style="text-align: center; width: 60px;">分类id</div></th>
                            <th align="center" axis="col3"><div style="text-align: center; width: 200px;">分类名称</div></th>
                            <th align="center" axis="col3"><div style="text-align: center; width: 200px;">添加时间</div></th>
                            <th align="center" axis="col6"><div style="text-align: center; width: 80px;">是否显示</div></th>
                            <th align="center" axis="col9"><div style="text-align: center; width: 60px;">排序</div></th>
                            <th align="center" axis="col9"><div style="text-align: center; width: 50px;">图片</div></th>
                            <th align="center" axis="col1" class="handle"><div style="text-align: center; width: 150px;">操作</div></th>
                            <th axis="col10"><div></div></th>
                        </tr>
                        </thead>
                    </table>
                </div>
            </div>
            <div class="tDiv">
                <div class="tDiv2">

                    <div class="fbutton">
                        <a href="{:U('Service.Service/addrepaircat')}">
                            <div title="新增分类" class="add">
                                <span><i class="fa fa-plus"></i>新增分类</span>
                            </div>
                        </a>
                    </div>
                </div>
                <div style="clear:both"></div>
            </div>
            <div style="height: auto;" class="bDiv" id="flexigrid"  data-url="{:U('Service.Service/delRepairCat')}">
                <table cellspacing="0" cellpadding="0" border="0" id="article_cat_table" class="flex-table autoht">
                    <tbody id="treet1">
                    <foreach name="cat_list" item="vo" key="k" >
                        <tr data-level="{$vo[level]}" parent_id_path ="{$vo.parent_id_path}" class="parent_id_{$vo.parent_id}" nctype="0" <if condition="$vo[level] gt 1"> style="display:none;"</if>>
                        <td class="sign" >
                            <if condition="$vo[level] lt 3">
                                <div style="text-align: center; width: 24px;margin-left:<?php echo ($vo[level] * 1); ?>em">
                                    <img onClick="treeClicked(this,{$vo.id},'{$vo.parent_id_path}')" nc_type="flex" status="open" fieldid="2" src="/public/static/images/tv-expandable.gif">
                                </div>
                            </if>
                        </td>

                        <td class="sort">
                            <div style="text-align: center; width: 60px;">{$vo.id}</div>
                        </td>
                        <td class="name">
                            <div style="text-align: center; width: 200px;">
                               {$vo.name}
                            </div>
                        </td>
                        <td class="name">
                            <div style="text-align: center; width: 200px;">
                                {$vo.add_time|date = "Y-m-d H:i:s",###}
                            </div>
                        </td>
                        <td align="center" class="">
                            <div style="text-align: center; width: 80px;">
                                <if condition='$vo[is_show] eq 1'>
                                    <span class="yes" onClick="changeTableVal('repair_cat','id','{$vo.id}','is_show',this)" ><i class="fa fa-check-circle"></i>是</span>
                                    <else />
                                    <span class="no" onClick="changeTableVal('repair_cat','id','{$vo.id}','is_show',this)" ><i class="fa fa-ban"></i>否</span>
                                </if>
                            </div>
                        </td>

                        <td class="sort">
                            <div style="text-align: center; width: 60px;">
                               {$vo.sort_order}
                            </div>
                        </td>
                        <td align="center" >
                            <div  style="text-align: center; width: 50px;">  <i id="img_i" class="fa fa-picture-o" onmouseover="layer.tips('<img src={$vo.image}>',this,{tips: [1, '#fff']});" onmouseout="layer.closeAll();"></i></div>
                        </td>
                        <td class="handle">
                            <div style="text-align: center; width: 170px; max-width:170px;">

                                <a href="{:U('Service.Service/addrepaircat',array('id'=>$vo['id']))}" class="btn blue"><i class="fa fa-pencil-square-o">编辑</i></a>

                    <a class="btn red" href="javascript:;" onclick="publicHandle({$vo['id']})"> <i class="fa fa-trash-o"></i>删除</a>


                            </div>
                        </td>

                        <td style="width: 100%;">
                            <div>&nbsp;</div>
                        </td>
                        </tr>
                    </foreach>
                    </tbody>
                </table>
            </div>
        </div>
</div>
<script>
    $(document).ready(function(){
        // 表格行点击选中切换
        $('.bDiv > table>tbody >tr').click(function(){
            $(this).toggleClass('trSelected');
        });
    });

    // 点击展开 收缩节点
    function treeClicked(obj,cat_id,parent_id_path){
        console.log(obj);
        var src = $(obj).attr('src');
        if(src == '/public/static/images/tv-expandable.gif')
        {
            $(".parent_id_"+cat_id).show();
            $(obj).attr('src','/public/static/images/tv-collapsable-last.gif');
        }else{
            $("tr[parent_id_path^='"+parent_id_path+"_']").hide().find('img').attr('src','/public/static/images/tv-expandable.gif');
            $(obj).attr('src','/public/static/images/tv-expandable.gif');

        }
    }
</script>
</body>
</html>